import 'package:factoryside/bean/city_list_entity.dart';

cityListEntityFromJson(CityListEntity data, Map<String, dynamic> json) {
	if (json['StatusCode'] != null) {
		data.statusCode = json['StatusCode'] is String
				? int.tryParse(json['StatusCode'])
				: json['StatusCode'].toInt();
	}
	if (json['Info'] != null) {
		data.info = json['Info'].toString();
	}
	if (json['Count'] != null) {
		data.count = json['Count'] is String
				? int.tryParse(json['Count'])
				: json['Count'].toInt();
	}
	if (json['Data'] != null) {
		data.data = new CityListData().fromJson(json['Data']);
	}
	return data;
}

Map<String, dynamic> cityListEntityToJson(CityListEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['StatusCode'] = entity.statusCode;
	data['Info'] = entity.info;
	data['Count'] = entity.count;
	if (entity.data != null) {
		data['Data'] = entity.data.toJson();
	}
	return data;
}

cityListDataFromJson(CityListData data, Map<String, dynamic> json) {
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	if (json['count'] != null) {
		data.count = json['count'] is String
				? int.tryParse(json['count'])
				: json['count'].toInt();
	}
	if (json['data'] != null) {
		data.data = new List<CityListDataData>();
		(json['data'] as List).forEach((v) {
			data.data.add(new CityListDataData().fromJson(v));
		});
	}
	if (json['errcode'] != null) {
		data.errcode = json['errcode'].toString();
	}
	if (json['errorId'] != null) {
		data.errorId = json['errorId'].toString();
	}
	return data;
}

Map<String, dynamic> cityListDataToJson(CityListData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['code'] = entity.code;
	data['msg'] = entity.msg;
	data['count'] = entity.count;
	if (entity.data != null) {
		data['data'] =  entity.data.map((v) => v.toJson()).toList();
	}
	data['errcode'] = entity.errcode;
	data['errorId'] = entity.errorId;
	return data;
}

cityListDataDataFromJson(CityListDataData data, Map<String, dynamic> json) {
	if (json['Code'] != null) {
		data.code = json['Code'] is String
				? int.tryParse(json['Code'])
				: json['Code'].toInt();
	}
	if (json['Name'] != null) {
		data.name = json['Name'].toString();
	}
	if (json['ParentCode'] != null) {
		data.parentCode = json['ParentCode'] is String
				? int.tryParse(json['ParentCode'])
				: json['ParentCode'].toInt();
	}
	if (json['ParentName'] != null) {
		data.parentName = json['ParentName'].toString();
	}
	return data;
}

Map<String, dynamic> cityListDataDataToJson(CityListDataData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['Code'] = entity.code;
	data['Name'] = entity.name;
	data['ParentCode'] = entity.parentCode;
	data['ParentName'] = entity.parentName;
	return data;
}